//
//  TimeUtil.swift
//  WeekTimeTable
//
//  Created by Sebarina Xu on 6/7/16.
//  Copyright © 2016 bocai. All rights reserved.
//

import Foundation


class TimeUtil {
    class func getCurrentHourAndMin() -> (Int, Int) {
        let date = NSDate()
        let dateFormatter = NSDateFormatter()
        dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
        dateFormatter.timeZone = NSTimeZone.localTimeZone()
        let dateStr = dateFormatter.stringFromDate(date)
        
        let componets = dateStr.componentsSeparatedByString(" ")
        if componets.count > 1 {
            let coms = componets[1].componentsSeparatedByString(":")
            if coms.count > 1 {
                return(Int(coms[0]) ?? 0, Int(coms[1]) ?? 0)
            }
        }
        
        return (0,0)
        
    }
}